Block Api
Functions
Publishes a property of a block inside a main component under a name that instances can set.
Add a source to the sourceSet property of the given block. If there already exists in source set an image with the same width, that existing image will be replaced. If the source set is or gets empty, the crop and content fill mode of the associated block will be set to the default values. Note: This fetches the resource from the given URI to obtain the image dimensions. It is recommended to use setSourceSet if the dimension is known.
Add a source to the sourceSet property of the given block. If there already exists in source set an image with the same width, that existing image will be replaced. If the source set is or gets empty, the crop and content fill mode of the associated block will be set to the default values. Note: This fetches the resource from the given URI to obtain the image dimensions. It is recommended to use setSourceSet if the dimension is known.
Add a source to the sourceSet property of the given block. If there already exists in source set a video with the same width, that existing video will be replaced. If the source set is or gets empty, the crop and content fill mode of the associated block will be set to the default values. Note: This fetches the resource from the given URI to obtain the video dimensions. It is recommended to use setSourceSet if the dimension is known.
Adjust the crop position/scale to at least fill the crop frame. On a page with a bleed, the content also covers the bleed, and the ratio includes the bleed. This needs the setting page/imageFillCoversBleed, which is on by default. Required scope: "layer/crop"
Align multiple blocks vertically within their bounding box or a single block to its parent. Required scope: "layer/move"
Align multiple blocks vertically within their bounding box or a single block to its parent. Required scope: "layer/move"
Appends a new or existing child to a block's children. A move fails when it would put a block with a matte inside its matte source, or on another page than its source. A page slice takes no children, and it can only be a child of a page with a rect shape. A video scene takes no page slice. A page slice that a block load or duplicate returns holds the blocks that it was saved with. The next update moves them onto the page, into the new place of the page slice. Required scope: "editor/add"
Inserts an effect at the end of the list of effects. The same effect can appear multiple times in the list and won't be removed if appended again. Required scope: "appearance/effect"
Inserts a mask at the end of the masks of the block. A mask can be used by more than one block. Required scope: "layer/clipping"
Appends a modifier to the modifiers of a shape. The same modifier can appear multiple times in the list. Required scope: "shape/change" on every block that uses the shape.
Appends a subshape to a compound shape. A shape has one owner, so the subshape is detached from its previous block or compound shape. Line shapes cannot be subshapes. The call fails when the shape tree would nest more than 128 shapes. Required scope: "shape/change"
Appends a text animator to the text animators of a block. A text animator belongs to one block at a time. Required scope: "appearance/animation"
Updates the sorting order of this block and all of its superjacent siblings so that the given block has a higher sorting order than the next superjacent sibling. If the block is parented to a track, it is first moved up in the hierarchy. Empty tracks and empty groups are passed by.
Updates the sorting order of this block and all of its manually created siblings so that the given block has the highest sorting order. If the block is parented to a track, it is first moved up in the hierarchy.
Query if the given block can be reverted to the intrinsic aspect ratio of its image/video content. Backs the "Original" crop preset (AssetTransformPreset.ContentAspectRatio).
Returns whether the font weight of the given block can be toggled between bold and normal.
Returns whether the font style of the given block can be toggled between italic and normal.
Perform a boolean operation on the given blocks.
Moves main components into a new container as variants of one component.
Makes a block a main component, so that instances can follow it.
Create a new block.
Creates a new animation, fails if type is unknown.
Create a new audio block by extracting a specific audio track from a video fill block.
Create multiple audio blocks by extracting all audio tracks from a video fill block.
Create a new blur, fails if type is unknown or not a valid blur type.
Creates new caption blocks from the given file.
Create a cutout block whose path will be the contour of the given blocks. The cutout path for each block is derived from one of the two ways:
Perform a boolean operation on the given Cutout blocks. The cutout offset of the new block is 0. The cutout type of the new block is that of the first block. When performing a CutoutOperation.DIFFERENCE operation, the first block is the block subtracted from.
Create a Cutout block.
Create a new effect block, fails if type is unknown or not a valid effect block type.
Create a new fill, fails if type is unknown.
Create editable graphic blocks from SVG markup, such as the SVG code that Adobe Illustrator copies. Each shape of the SVG becomes a graphic block with a vector path shape, its fill color or gradient, and its stroke. More than one block goes into a group. Embedded images, text, filters, masks and patterns have no shape. Each such part becomes a graphic block with an image fill of only that part. The blocks are not attached to a parent. An SVG user unit is a pixel in a scene measured in pixels. In a scene measured in millimeters or inches it is a point, as Adobe Illustrator writes it.
Creates an instance of a main component. Attach it with appendChild. An instance follows every property that it does not override. Its children cannot be added, reordered or destroyed. Hide a child with setVisible.
Create a new mask block. A mask cuts its block down to the area of the mask's shape. Give the mask a shape with setShape; a mask without a shape has no effect. The shape is evaluated in the frame of the block that the mask is attached to. The mask properties are mask/mode, mask/opacity, mask/feather, mask/expansion and mask/inverted.
Create a new shape modifier block, fails if type is unknown or not a valid modifier block type. A modifier changes the path of a shape, or draws the shape several times.
Create a new shape, fails if type is unknown.
Create a new text animator block. A text animator changes the glyphs of a text block that its range selector covers: their position, scale, rotation, skew, opacity, colors, stroke width, tracking and blur. Every property of a text animator can have keyframes.
Creates a new transition, fails if type is unknown. Its transition/overlap value is initialized from the current clip/defaultTransitionOverlapEnabled editor setting.
Destroys a block. A page slice destroys the blocks that it owns on its page, without a check of their scopes, as a page destroys its children. This holds for the last page slice too: its page becomes an empty page without page slices, at the same size. To keep the content, move the page slice out with movePageSliceOutOfPage first. Destroying a page slice runs an internal update. Required scope: "lifecycle/destroy"
Turns an instance into plain blocks that no longer follow the main component.
Distribute multiple blocks vertically within their bounding box so that the space between them is even. Required scope: "layer/move"
Distribute multiple blocks vertically within their bounding box so that the space between them is even. Required scope: "layer/move"
Duplicates a block including its children. Copies the current duration, even if initialization is pending on the original. The duplicate does not resume initialization. A scene cannot be duplicated, and the call throws for it. Required scope: "lifecycle/duplicate" If the block is parented to a track that is set always-on-bottom, the duplicate is inserted in the same track immediately after the block. Otherwise, the duplicate is moved up in the hierarchy. The duplicate of a page slice takes a copy of the blocks that the page slice owns on its page. The call runs an internal update for a page slice on a page, also while features/implicitUpdatesEnabled is off. A block that a page slice owns gets its Percent position and size in design units in the copy. The copy does not follow the size of its page.
Changes selection from selected group to a block within that group. Nothing happens if block is not a group. Required scope: "editor/select"
Changes selection from a group's selected block to that group. Nothing happens if block is not a group. Required scope: "editor/select"
Exports a design block element as a PDF and emits the bytes as chunks while they are produced, so the document is never held in memory as a whole. This is the same export as the export overload that takes an OutputStream. Prefer that overload when the destination is a file, a content:// target or an upload stream, and this one when the chunks feed a coroutine pipeline. Performs an internal update to resolve the final layout for the blocks. Note: The returned flow is cold. Each collection runs one export, which starts when the collection starts, and the flow completes after the last chunk. Collect it on the engine thread, like every other engine call. Note: The flow has no buffer. The encoder waits until the collector has taken a chunk, so a slow collector slows the encoder down and the chunks do not queue up in memory. A collector that keeps the chunks, for example with toList(), holds the whole document in memory again. Note: When the collector leaves or its coroutine is cancelled, the export stops. Note: This overload has no mimeType parameter and always exports a PDF. The export overload that takes an OutputStream also streams raster formats. Note: The export happens in a background thread and the Engine instance in the onPreExport lambda is a separate instance. Use it only until the collection ends. Use this lambda to configure the background engine for export. It holds only the buffers that the exported scene uses, so create any other buffer on it here. A later export of a scene without video or audio can reuse that engine with the resources it loaded, so onPreExport runs on every export, and what it changes stays for the next export: settings, role, global scopes, asset sources and event subscriptions. If uriResolver is provided it will be set on the background engine before the exported scene is loaded and once more after onPreExport is invoked (so it takes precedence if onPreExport also sets a resolver).
Exports a design block element as a file of the given mime type. The export of a page slice gives the part of its page inside the page slice, with the bleed of the page on all four sides. At a fold, that bleed shows the content of the page slice beside it. The export of a hidden page slice shows it and its content. Performs an internal update to resolve the final layout for the blocks. Note: The export happens in a background thread and the Engine instance in the onPreExport lambda is a separate instance. Use it only until the suspending function resumes. Use this lambda to configure the background engine for export. It holds only the buffers that the exported scene uses, so create any other buffer on it here. A later export of a scene without video or audio can reuse that engine with the resources it loaded, so onPreExport runs on every export, and what it changes stays for the next export: settings, role, global scopes, asset sources and event subscriptions. If uriResolver is provided it will be set on the background engine before the exported scene is loaded and once more after onPreExport is invoked (so it takes precedence if onPreExport also sets a resolver).
Exports multiple design block elements as files of the given mime type. Performs an internal update to resolve the final layout for the blocks. This method is more memory efficient than calling export repeatedly for multiple blocks as it reuses a single worker engine for all exports. Note: The export happens in a background thread and the Engine instance in the onPreExport lambda is a separate instance. Use it only until the suspending function resumes. Use this lambda to configure the background engine for export. It holds only the buffers that the exported scene uses, so create any other buffer on it here. A later export of a scene without video or audio can reuse that engine with the resources it loaded, so onPreExport runs on every export, and what it changes stays for the next export: settings, role, global scopes, asset sources and event subscriptions. If uriResolver is provided it will be set on the background engine before the exported scene is loaded and once more after onPreExport is invoked (so it takes precedence if onPreExport also sets a resolver).
Exports a design block element as a PDF and writes the bytes into output while they are produced, so the document is never held in memory as a whole. Prefer this over the export that returns a ByteBuffer for large multi-page documents such as photo books and magazines: the peak memory is the working set of one page, whatever the number of pages. Performs an internal update to resolve the final layout for the blocks. Note: The export happens in a background thread and the Engine instance in the onPreExport lambda is a separate instance. Use it only until the suspending function resumes. Use this lambda to configure the background engine for export. It holds only the buffers that the exported scene uses, so create any other buffer on it here. A later export of a scene without video or audio can reuse that engine with the resources it loaded, so onPreExport runs on every export, and what it changes stays for the next export: settings, role, global scopes, asset sources and event subscriptions. If uriResolver is provided it will be set on the background engine before the exported scene is loaded and once more after onPreExport is invoked (so it takes precedence if onPreExport also sets a resolver). Note: output is written from that background thread with one write for each chunk, so a slow destination slows the encoder down and the chunks do not queue up in memory. ExportOptions.pdfChunkSize bounds the size of a chunk. The caller keeps the ownership of output and closes it, for example with use. Note: When the export fails or the calling coroutine is cancelled, the export stops and output holds an incomplete document. A write that blocks delays the cancellation until it returns.
Exports the audio of a design block as an audio file of the given mime type. A page mixes the audio of all its blocks, a track mixes its children, and an audio block or a block with a video fill exports its own audio. A scene exports its first page. Note: The export happens in a background thread and the Engine instance in the onPreExport lambda is a separate instance. Use it only until the suspending function resumes. Use this lambda to configure the background engine for export. It holds only the buffers that the exported scene uses, so create any other buffer on it here. A later export of a scene without video or audio can reuse that engine with the resources it loaded, so onPreExport runs on every export, and what it changes stays for the next export: settings, role, global scopes, asset sources and event subscriptions. If uriResolver is provided it will be set on the background engine before the exported scene is loaded and once more after onPreExport is invoked (so it takes precedence if onPreExport also sets a resolver).
Exports the audio of multiple design blocks as audio files of the given mime type, one after the other, with one background engine. Otherwise it works like the exportAudio overload for one block.
Exports a small image of a block to show in your app. A preview does not count as an export.
Exports a design block as a video file of the given mime type. Note: MP4 exports embed a PNG cover at the page cover time when playback/coverTimeEnabled is true, else at the page playback position. coverTimeOffset overrides both. An MP4 export of a scene uses its first frame as the cover. Note: The export will run across multiple iterations of the update loop. In each iteration a frame is scheduled for encoding. Note: The export happens in a background thread and the Engine instance in the onPreExport lambda is a separate instance. Use it only until the suspending function resumes. Use this lambda to configure the background engine for export. It holds only the buffers that the exported scene uses, so create any other buffer on it here. A later export of a scene without video or audio can reuse that engine with the resources it loaded, so onPreExport runs on every export, and what it changes stays for the next export: settings, role, global scopes, asset sources and event subscriptions. If uriResolver is provided it will be set on the background engine before the exported scene is loaded and once more after onPreExport is invoked (so it takes precedence if onPreExport also sets a resolver).
Exports multiple design blocks as video files of the given mime type, one after the other, with one background engine. Otherwise it works like the exportVideo overload for one block.
Exports multiple design blocks as video files of the given mime type. Note: MP4 exports embed a PNG cover at the page cover time when playback/coverTimeEnabled is true, else at the page playback position. coverTimeOffset overrides both. An MP4 export of a scene uses its first frame as the cover. Videos are exported sequentially, with progress reported for each video. This method is more memory efficient than calling exportVideo repeatedly for multiple blocks as it reuses a single worker engine for all exports. Note: The export will run across multiple iterations of the update loop. In each iteration a frame is scheduled for encoding. Note: The export happens in a background thread and the Engine instance in the onPreExport lambda is a separate instance. Use it only until the suspending function resumes. Use this lambda to configure the background engine for export. It holds only the buffers that the exported scene uses, so create any other buffer on it here. A later export of a scene without video or audio can reuse that engine with the resources it loaded, so onPreExport runs on every export, and what it changes stays for the next export: settings, role, global scopes, asset sources and event subscriptions. If uriResolver is provided it will be set on the background engine before the exported scene is loaded and once more after onPreExport is invoked (so it takes precedence if onPreExport also sets a resolver).
Exports a design block element as a file of the given mime type. The export of a page slice gives the part of its page inside the page slice, with the bleed of the page on all four sides. At a fold, that bleed shows the content of the page slice beside it. The export of a hidden page slice shows it and its content. Performs an internal update to resolve the final layout for the blocks. Note: The export happens in a background thread and the Engine instance in the onPreExport lambda is a separate instance. Use it only until the suspending function resumes. Use this lambda to configure the background engine for export. It holds only the buffers that the exported scene uses, so create any other buffer on it here. A later export of a scene without video or audio can reuse that engine with the resources it loaded, so onPreExport runs on every export, and what it changes stays for the next export: settings, role, global scopes, asset sources and event subscriptions. If uriResolver is provided it will be set on the background engine before the exported scene is loaded and once more after onPreExport is invoked (so it takes precedence if onPreExport also sets a resolver).
Exports multiple design block elements as files of the given mime type with color masks. Performs an internal update to resolve the final layout for the blocks. This method is more memory efficient than calling exportWithColorMask repeatedly for multiple blocks as it reuses a single worker engine for all exports. Note: The export happens in a background thread and the Engine instance in the onPreExport lambda is a separate instance. Use it only until the suspending function resumes. Use this lambda to configure the background engine for export. It holds only the buffers that the exported scene uses, so create any other buffer on it here. A later export of a scene without video or audio can reuse that engine with the resources it loaded, so onPreExport runs on every export, and what it changes stays for the next export: settings, role, global scopes, asset sources and event subscriptions. If uriResolver is provided it will be set on the background engine before the exported scene is loaded and once more after onPreExport is invoked (so it takes precedence if onPreExport also sets a resolver).
Resize and position a block to entirely fill its parent block. The crop values of the block, except for the flip and crop rotation, are reset if it can be cropped. If the size of the block's fill is unknown, the content fill mode is changed from Crop to Cover to prevent invalid crop values. A block that follows a transform parent stops following it. A page slice takes its position from its page, so the call fails with BLOCK.POSITION_PARENT_CONTROLLED on one. Required scope: "layer/move"
Return all blocks currently known to the engine.
Gets the sorted names of the published properties of a main component.
Returns all blocks that overlap an exclusion area on their page.
Query all metadata keys that exist on this block.
Return all placeholder blocks in the current scene.
Get all available properties of a block.
Get all currently selected blocks.
Return all blocks that are not attached to any scene.
Get the properties of a block that are bound to a variable.
Gets the sorted names of the variant properties of a main component.
Finds all blocks with the given kind.
Finds all blocks with the given name.
Finds all design blocks with the given type.
Finds all blur blocks with the given type.
Finds all effect blocks with the given type.
Finds all mask blocks.
Finds all modifier blocks with the given type.
Finds all shape blocks with the given type.
Finds all text animator blocks.
Adjusts the crop in order to flip the content along its own horizontal axis.
Adjusts the crop in order to flip the content along its own vertical axis.
Begins loading the required audio and video resource for the given video fill or audio block. If the resource had been loaded earlier and resulted in an error, it will be reloaded. A buffer:// source loads like a file. The call finishes once the engine can read the video, audio or Lottie in the buffer, with the images that a Lottie references. It fails when the buffer holds no file that it can read. A missing or empty buffer, or raw audio samples on an audio block, finish at once.
Begins loading the resources of the given blocks and their children. If the resource had been loaded earlier and resulted in an error, it will be reloaded. Note: This function is useful for preloading resources before they are needed. A page slice also loads the resources of the blocks that it owns on its page. The call runs no update, so a block that no update has placed on the page slice yet is left out. Warning: For elements with a source set, all elements in the source set will be loaded.
Generate a thumbnail sequence for the given audio block or video fill. A thumbnail in this case is a chunk of samples in the range of 0 to 1. In case stereo data is requested, the samples are interleaved, starting with the left channel. Note: Only one request per block runs at a time. A second request for the same block waits for the first to finish instead of failing. Note: numberOfSamples counts samples per channel, so each emission carries samplesPerChunk * numberOfChannels floats and the last one may be shorter. Note: A chunk arrives at the end of an engine update. Cancelling the collecting coroutine also drops the chunks that wait for delivery. Note: Collect on the main thread; collection throws otherwise.
Generate a thumbnail sequence for the given video fill or design block. Note: Only one request per block runs at a time. A second request for the same block waits for the first to finish instead of failing. Note: For a video fill, cancelling has no effect once the first frame has been scheduled — the engine still produces the remaining frames. Cancelling the collecting coroutine stops your collector from seeing them. Design block sequences cancel at any time. Note: A frame arrives at the end of an engine update, after the update that rendered it. Note: Collect on the main thread; collection throws otherwise.
Get the properties of a block that have keyframes.
Get the value that the keyframes give a block property at a time. A relative track adds the static value. A property without keyframes gives its static value. A position/x or position/y track overrides that axis of a position track. Without its own track, position/x gives the x of the position track. An angle is in the angle unit of the scene. Animation presets and the turn along a motion path are not included. A rotation track also moves a block without an anchor, so that it turns around its frame centre. That move is not included either. Throws BLOCK.KEYFRAMES_TIME_OUT_OF_RANGE for a time outside 0, 1, or BLOCK.KEYFRAMES_PROPERTY_NOT_ANIMATABLE when the property has no keyframes and isPropertyAnimatable returns false.
Get information about all audio tracks from a video fill block.
Get the number of available audio tracks in a video fill block.
Get the duration in seconds of the video or audio resource that is attached to the given block.
Get the background color of the given design block.
Get the blend mode of the given design block.
Get the blur block of the given design block. For example, a graphic has no blur right after create(DesignBlockType.Graphic), although isBlurEnabled returns true.
Get the value of a boolean property of the given design block.
Get all children of the given block. Children are sorted in their rendering order: Last child is rendered in front of other children.
Get the value of a color property of the given design block.
Gets a published property of an instance as text.
Query a block's horizontal content fill alignment.
Query a block's content fill mode.
Query a block's vertical content fill alignment.
Get the crop rotation of the given design block.
Get the crop scale ratio of the given design block. On a page with a bleed, a ratio of 1 means that the content covers the page and its bleed. This needs the setting page/imageFillCoversBleed, which is on by default.
Get the crop scale in x direction of the given design block.
Get the crop scale in y direction of the given design block.
Get the crop translation in x direction of the given design block.
Get the crop translation in y direction of the given design block.
Extracts the dominant colors from the rendered appearance of a block.
Get the value of a double property of the given design block.
Get the drop shadow's blur radius on the x axis of the given design block.
Get the drop shadow's blur radius on the y axis of the given design block.
Get the drop shadow's clipping of the given design block.
Get the drop shadow color of the given design block.
Get the drop shadow's x offset of the given design block.
Get the drop shadow's y offset of the given design block.
Get the playback duration of the given block in seconds. The duration defines for how long the block is active in the scene during playback. For a scene, the sum of the durations of its pages, without the pages hidden with setVisible. Note: The duration is ignored when the scene is not in Video mode.
Get a list of all effects attached to this block.
Get the block that an effect block reads.
Get the value of an enum property of the given design block.
Get all the possible values of an enum given an enum property.
Returns the block containing the fill properties of the given block. For example, a graphic has no fill right after create(DesignBlockType.Graphic), although isFillEnabled returns true.
Query whether the fill of the given design block is marked as overprint.
Get the fill color of the given design block.
Get the value of a float property of the given design block.
Returns unique stored requests intersecting the text range. Legacy URI fonts have no request.
Get a block's layout height. The layout height is only available after an internal update loop, which may not happen immediately.
Get a block's layout width. The layout width is only available after an internal update loop, which may not happen immediately.
Get a block's layout position on the x-axis. The layout position is only available after an internal update loop, which may not happen immediately.
Get a block's layout position on the y-axis. The layout position is only available after an internal update loop, which may not happen immediately.
Get the height of the block's axis-aligned bounding box in the scene's global coordinate space. The scene's global coordinate space has its origin at the top left.
Get the width of the block's axis-aligned bounding box in the scene's global coordinate space. The scene's global coordinate space has its origin at the top left.
Get the x position of the block's axis-aligned bounding box in the scene's global coordinate space. The scene's global coordinate space has its origin at the top left.
Get the y position of the block's axis-aligned bounding box in the scene's global coordinate space. The scene's global coordinate space has its origin at the top left.
Get the gradient color stops property of the given design block.
Query a block's height.
Query a block's mode for its height.
Get the "in" animation of the given block.
Get the value of an int property of the given design block.
Get the mode of the keyframe track of a block property. Throws BLOCK.KEYFRAMES_NO_TRACK when the property has no keyframes, or BLOCK.KEYFRAMES_PROPERTY_NOT_ANIMATABLE when isPropertyAnimatable also returns false.
Get the keyframes of a block property, sorted by time. Throws BLOCK.KEYFRAMES_PROPERTY_NOT_ANIMATABLE when the property has no keyframes and isPropertyAnimatable returns false.
Get the kind of the given block, fails if the block is invalid.
Get the "loop" animation of the given block.
Gets the main component of an instance.
Get the masks of a block, in the order in which they combine.
Get the matte of a block.
Get a metadata value of a block identified by a key. If the key does not exist, yet, this method will fail.
Get the modifiers of a shape, in the order they apply to its path.
Get a block's name.
Get the opacity of the given design block.
Gets the "out" animation of the given block.
Returns the page slice that owns a block on its page. A page slice has no children, so the block is a child of the page, or of a group on the page. The page slice under the center of the block owns it. On a fold, the earlier page slice owns it. A block outside the page belongs to the nearest page slice. A block in a group belongs where its group does. Note that the call runs an internal update when the block has no frame. It does the same when the page has page slices that no update laid out yet.
Returns the page slices of a page, in reading order. The list holds hidden page slices too. It is the order of the page slices among the children of the page.
Query a block's parent.
Gets the playback speed multiplier of a block that supports playback control.
Get the playback time of the given block. During an export, this returns the time of the playhead and not the time of the exported frame.
Query a block's x position. The position is the block's local origin: the top-left corner of its untransformed frame, in the coordinate space of its parent. Rotation turns the block, and a flip mirrors it, around the center of its frame. So for a rotated or flipped block, the position is not the visual left edge. Use getGlobalBoundingBoxX for the axis-aligned visual bounds.
Query a block's mode for its x position. x * On a page slice the mode is PositionMode.AUTO, because the page sets its position. x * @param block the block to query.
Query a block's y position. The position is the block's local origin: the top-left corner of its untransformed frame, in the coordinate space of its parent. Rotation turns the block, and a flip mirrors it, around the center of its frame. So for a rotated or flipped block, the position is not the visual top edge. Use getGlobalBoundingBoxY for the axis-aligned visual bounds.
Query a block's mode for its y position. y * On a page slice the mode is PositionMode.AUTO, because the page sets its position. y * @param block the block to query.
Get the type of a property given its name.
Query a block's rotation in the scene's angle unit (radians by default, see SceneApi.setAngleUnit).
Get the position and size of the axis-aligned bounding box for the given blocks in screen space.
Returns the block containing the shape properties of the given block. For example, a graphic has no shape right after create(DesignBlockType.Graphic).
Returns the source set of a source set property of the given block.
Get the name of the spot color assigned to a cutout type.
Get the current state of a block. Note If this block is in error state or this block has a Shape block, Fill block or Effect block(s), that is in error state, the returned state will be BlockState.Error. Else, if this block is in pending state or this block has a Shape block, Fill block or Effect block(s), that is in pending state, the returned state will be BlockState.Pending. Else, the returned state will be BlockState.Ready. A BlockState.Error carries the catalog error of the failed load in BlockState.Error.engineError when the engine knows it, such as a .lottie archive that cannot be read or a video that cannot be decoded. Note: A block whose CMYK or spot color needs the document CMYK profile is BlockState.Pending while that profile loads. Note: With soft proofing on, a block that draws inside a page is BlockState.Pending while the proof profile loads. It reports a BlockState.Error.Type.SOFT_PROOF error only when it has no other error or pending state. Note: Runs an engine update for a resource that nothing asked for yet, while the scene has a change to lay out. A font set just before this call is then reported as pending.
Get the value of a string property of the given design block.
Get the stroke color of the given design block.
Get the stroke corner geometry of the given design block.
Get the custom dash pattern of the given design block's stroke.
Query the cap geometry at the trailing edge of each dash piece.
Get the dash offset of the given design block's stroke.
Query the cap geometry at the leading edge of each dash piece.
Query the cap geometry at the end of an open stroked path.
Returns the fill block that paints the stroke of the given block.
Query whether the stroke of the given design block is marked as overprint.
Get the stroke position of the given design block.
Query the cap geometry at the start of an open stroked path.
Get the stroke style of the given design block.
Get the stroke width of the given design block.
Get the subshapes of a compound shape, in the order in which they combine.
Get the text animators of a block, in the order they apply.
Returns a range of a text block as HTML with its formatting, for the clipboard. The HTML states the color, background color, weight, italic, decorations, script style, case, font size and typeface of each run as inline CSS. It states the list style, list level and alignment of each paragraph. Other apps read it on paste, and replaceTextWithHTML reads every property back. The typeface applies only when a typeface of the scene holds its font file. The font size and the line height are CSS values, so other apps show them as the block does.
Returns the ordered unique list of background colors of the text in the selected range. Text without a background color is reported as a fully transparent color.
Returns the unique baseline shift values across the grapheme range, in design units.
Returns the ordered list of text cases of the text in the selected range.
Returns the tight ink-paint bounding box of each grapheme in the given range. Required scope: "text/character"
Returns the ordered unique list of colors of the text in the selected range.
Returns the indices of the selected range of the text block that is currently being edited. If both the start and end index of the returned range have the same value, then the text cursor is positioned at that index.
Returns the ordered list of unique text decoration configurations in the selected range.
Gets the effective horizontal alignment of a text block. If the alignment is set to Auto, this returns the resolved alignment (Left or Right) based on the text direction of the first logical run. This never returns 'Auto'.
Returns the ordered unique list of font sizes of the text in the selected range.
Returns the ordered unique list of font styles of the text in the selected range.
Returns the ordered unique list of font weights of the text in the selected range.
Returns the paragraph-level horizontal alignment override for a specific paragraph, or the block-level alignment for negative paragraph indices.
Returns the unique kerning values across the grapheme range.
Returns the bounds of the visible area of the given line of the text block. The values are in the scene's global coordinate space (which has its origin at the top left).
Returns the line height multiplier for a specific paragraph of a text block.
Returns the list nesting level for a specific paragraph of a text block.
Returns the list style for a specific paragraph of a text block.
Returns the SVG path currently used as the text block's baseline, or null if normal layout is active.
Returns whether text is placed on the opposite side of the baseline path.
Returns the start offset along the baseline path as a proportion of the path length.
Returns the unique OpenType feature lists across the grapheme range. Each list holds one entry per tag, sorted by tag. A range without features returns one empty list.
Returns the 0-based paragraph indices that overlap the given range.
Returns current font provenance, missing glyph ranges, and optional planar layout.
Returns all text runs within the given range of text.
Returns the ordered list of unique script styles of the text in the selected range.
Returns the unique variation axis value lists across the grapheme range. Each list holds one entry per tag, sorted by tag. A range without axis values returns one empty list.
Returns the text content of the given visible line of the text block.
Returns the number of visible lines in the given text block.
Get the time offset of the given block relative to its parent.
Returns the block whose transform the given block follows.
Gets the outgoing transition assigned to a clip.
Get the trim length of the given block or fill.
Get the trim offset of this block. Note: This requires the video or audio clip to be loaded.
Get the type of the given block, fails if the block is invalid.
Returns the typeface property of the text block. Does not return the typefaces of the text runs.
Returns the typefaces of the text block.
Get the value of a uri property of the given design block.
Get a block's unique identifier.
Get the variable that a block property is bound to.
Gets the value of a variant property of a main component.
Get the value of a vec2 property of the given design block.
Get the video height in pixels of the video resource that is attached to the given block.
Get the video width in pixels of the video resource that is attached to the given block.
Get the audio volume of the given block.
Query a block's width.
Query a block's mode for its width.
Group blocks together. The group becomes the blocks' new parent and takes the first block's parent as its own. Grouping does not change the children's positions: they stay relative to the group's parent, not to the group. In nested groups, they stay relative to the first ancestor that is not a group. The engine computes the group's position and size from the children's combined bounds. Moving the group moves all of its children by the same offset.
Check if the block has metadata associated with the key.
Returns whether a block has its own anchor. Setting transform/anchor/x or transform/anchor/y, even to 0, or giving one of them keyframes, gives a block an anchor. A rotation keyframe track turns a block with an anchor around the anchor, and a block without one around its frame center, as setRotation does.
Insert a new or existing child at a certain position in the parent's children. A move fails when it would put a block with a matte inside its matte source, or on another page than its source. A page slice takes no children, and it can only be a child of a page with a rect shape. A video scene takes no page slice. A page slice that a block load or duplicate returns holds the blocks that it was saved with. The next update moves them onto the page, into the new place of the page slice. Required scope: "editor/add"
Inserts an effect at the given index into the list of effects of the given block. The same effect can appear multiple times in the list and won't be removed if appended again. Required scope: "appearance/effect"
Inserts a mask at the given index into the masks of the block. A mask can be used by more than one block. Required scope: "layer/clipping"
Inserts a modifier at the given index into the modifiers of a shape. The same modifier can appear multiple times in the list. Required scope: "shape/change" on every block that uses the shape.
Inserts a subshape at the given index of a compound shape. The subshape at index 0 is the base, and each later subshape combines with the result so far by shape/compound/mode. The placement properties of the subshape (shape/position/x, shape/width, shape/rotation, ...) place it in the compound's coordinate space. A shape has one owner, so the subshape is detached from its previous block or compound shape. Line shapes cannot be subshapes. The call fails when the shape tree would nest more than 128 shapes. Required scope: "shape/change"
Inserts a text animator at the given index into the text animators of a block. A text animator belongs to one block at a time. Required scope: "appearance/animation"
Confirms that a given set of blocks can be aligned.
Check if a scope is allowed for a given block.
Query a block's always-on-bottom property.
Query a block's always-on-top property.
Returns whether the audio and video resource for the given video fill or audio block is loaded. Note that the function is unstable and mared with UnstableEngineApi. A buffer:// source counts as loaded once the engine has read its file, with the images that a Lottie references. A missing or empty buffer, or raw audio samples on an audio block, count as loaded.
Query if the background of the given design block is enabled.
Query if blur is enabled for the given block. The flag does not depend on an attached blur block. It defaults to true, so a fresh graphic reports its blur as enabled while getBlur returns an invalid block.
Query a block's clipped state. If true, the block should clip
Checks whether blocks could be combined.
Checks whether a block is a main component.
Check if the crop aspect ratio is locked for the given block. When locked, crop handles will maintain the current aspect ratio during resize.
Confirms that a given set of blocks can be distributed. A page slice cannot be distributed, so the result is false when blocks holds one.
Query if the drop shadow of the given design block is enabled.
Queries whether an effect block is enabled and therefore applies its effect.
Query if the fill of the given design block is enabled. The flag does not depend on an attached fill block. It defaults to true, so a fresh graphic reports its fill as enabled while getFill returns an invalid block.
Query a block's horizontal flip state.
Query a block's vertical flip state.
Query whether the block is muted due to engine constraints.
Confirms that a given set of blocks can be grouped together. A caption or a caption track cannot be grouped, because a caption plays from the caption track of its page.
Query if the given block is included on the exported result.
Checks whether a block is the top block of an instance.
Checks whether a graphic block originated as a line shape.
Query whether the block is looping.
Query whether the block is muted.
Returns whether the block is a duration source block.
Query whether the placeholder behavior for a block is enabled.
Query whether the placeholder button for a block is shown.
Query whether the placeholder overlay pattern for a block is shown.
Query whether the placeholder function for a block is enabled.
Returns whether the block is currently during active playback.
Check whether a property of a block can have keyframes.
Check if a property with a given name is readable.
Check if a property with a given name is writeable.
Check if a property with a given name is writeable.
Query whether a scope is enabled for a given block.
Get the selected state of a block.
Return whether the given block or fill is currently set to play its contents while the rest of the scene remains paused.
Query if the stroke of the given design block is enabled.
Query a block's transform locked state. If true, the block's transform can't be changed. The lock covers the static transform: keyframe tracks on the position, rotation, size, scale, anchor or skew still animate a locked block.
Check if a block is valid. A block becomes invalid once it has been destroyed.
Query a block's visibility.
Returns whether the block should be visible on the canvas at the current playback time.
Loads existing blocks from an archive. The archiveUri should be that of a file previously saved with saveToArchive. The blocks are not attached by default and won't be visible until attached to a page or the scene. The UUID of the loaded blocks is replaced with a new one.
Loads existing blocks from the given string. The blocks are not attached by default and won't be visible until attached to a page or the scene. The UUID of the loaded blocks is replaced with a new one. A damaged string, such as one with a missing key or a value of the wrong type, throws and adds no block.
Loads existing blocks from a URL.
Moves a page without page slices, or a page slice of another page, into a page with page slices. The content of the moved page or page slice moves along and keeps its ids. A moved page slice keeps its id. A page becomes a new page slice, and its id becomes invalid. The page slice keeps its size along the axis of page and takes the shared size across it. The moved content is placed above the content of page, in its own order. When the move takes the last page slice of its page, that page stays as an empty page without page slices. The move fails when a content block would change the page slice that owns it. Conversion keeps the supported appearance keyframes. Tracks of a page slice use the playback clock of its page. Conversion refuses preset animations and other tracks, such as geometry and crop tracks. MovePageSliceOptions.convertSourceToPage refuses a remaining page slice with preset animations or keyframes. Note that the call runs an internal update even when implicit updates are disabled. It records no undo step: call EditorApi.addUndoStep after the move, as after any other edit. It fails while the engine switches the active history.
Moves a page slice and its content to a new page without page slices. The new page joins the parent of the source page. The id of the page slice becomes invalid. The content keeps its ids. The page slices after it close the gap. An enabled fill of the page slice stays. Otherwise the new page takes the fill of the source page when MovePageSliceOptions.convertSourceToPage acts, and a white fill when it does not. When the move takes the last page slice, the source stays as an empty page without page slices. Conversion keeps the supported appearance keyframes. Tracks of a page slice use the playback clock of its page. Conversion refuses preset animations and other tracks, such as geometry and crop tracks. MovePageSliceOptions.convertSourceToPage refuses a remaining page slice with preset animations or keyframes. Note that the call runs an internal update even when implicit updates are disabled. It records no undo step: call EditorApi.addUndoStep after the move, as after any other edit. It fails while the engine switches the active history.
Subscribe to block click events. Note: DesignBlock is emitted at the end of the engine update if it has been clicked.
Subscribe to changes in the current set of selected blocks.
Subscribe to changes to the state of a block. Like getState, the state of a block is determined by the state of itself and its Shape, Fill and Effect block(s).
Checks whether the given block references any text variables. Doesn't check the block's children or its variable bindings.
Removes the effect at the given index. Required scope: "appearance/effect"
Remove the keyframe track of a block property, so the static value applies again. Does nothing for an animatable property without keyframes. Throws BLOCK.KEYFRAMES_PROPERTY_NOT_ANIMATABLE when the property has no keyframes and isPropertyAnimatable returns false. Required scope: the scopes that setKeyframes needs for the removed track.
Removes the mask at the given index. The mask block is not destroyed. Required scope: "layer/clipping"
Remove metadata associated with the key from the given block.
Removes the modifier at the given index from the modifiers of a shape. The modifier is not destroyed. Required scope: "shape/change" on every block that uses the shape.
Remove the block as duration source block for the page. If a scene or page given set as block, it is deactivated for all blocks in the scene or page.
Removes the subshape at the given index of a compound shape. The subshape is not destroyed. Required scope: "shape/change"
Removes selected range of text of the given text block. Required scope: "text/edit"
Removes the text animator at the given index from a block. The text animator is not destroyed. Required scope: "appearance/animation"
Removes the outgoing transition of a clip.
Remove the variable binding of a block property. The property keeps its current value. Does nothing if the property is not bound.
Inserts the given text into the selected range of the text block. Required scope: "text/edit"
Replaces a range of a text block with the text and the formatting of HTML, such as the HTML of a paste. HTML from getTextAsHTML sets every property it carries. Its typeface applies only when a typeface of the scene holds its font file. Otherwise the text keeps the typeface at the cursor, with the weight and style of the source. HTML of another app, such as Google Docs, Word, a web page or an Apple app, sets weight, italic and decorations. It also sets the script style, case, colors, font size, letter spacing, line height, lists and alignment. A CSS px is one pixel of a scene whose font size unit is the pixel. The text takes the first font family of the HTML that a typeface of the asset sources has. Without such a typeface, it keeps the typeface at the cursor. A gray, black or white that covers the largest part of the text is the default color of that app. It is not applied, and the same rule applies to the background color. A pasted paragraph without a list keeps the list of the target paragraph. Without the "text/character" scope, only the text is inserted, with the style at the cursor. Without the "fill/change" scope, or when the text color is bound to a variable, no color is pasted. When the font size or the typeface of the block is bound to a variable, it is not pasted. While the block is being edited and no range is given, the selection is replaced and the cursor moves behind the inserted text. Required scope: "text/edit"
Resets the manually set crop of the given design block. The block's content fill mode is set to ContentFillMode.COVER. If the block has a fill, the crop values are updated so that it covers the block. Required scope: "layer/crop"
Removes all overrides of an instance.
Resize all blocks to the given size. The content of the blocks is automatically adjusted to fit the new dimensions.
Saves the given blocks to an archive. Note: All given block handles must be valid, otherwise this call returns an error.
Saves the given blocks to a proprietary string. If given the root of a block hierarchy, e.g. a page with multiple children, the entire hierarchy is saved. If a resource uri of any block in that hierarchy has a scheme that is not in allowedResourceSchemes, an exception will be thrown. Note: All given block handles must be valid, otherwise an exception will be thrown.
Saves the given blocks to a proprietary string, as saveToString does, and passes each resource URI whose scheme is not in allowedResourceSchemes to onDisallowedResourceScheme instead of throwing. Note: All given block handles must be valid, otherwise an exception will be thrown.
Scales the block and all of its children proportionally around the specified relative anchor point. This updates the position, size and style properties (e.g. stroke width) of the block and its children. With the setting features/implicitUpdatesEnabled off, the call updates only when a block that it reads has no layout yet, as right after an undo. It reads the block, every child of it and each transform parent. That update also lays out every other pending change. Required scope: "layer/resize"
Selects the given block and deselects all other blocks.
Updates the sorting order of this block and all of its manually created and subjacent siblings so that the given block will have a lower sorting order than the next subjacent sibling. If the block is parented to a track, it is first moved up in the hierarchy. Empty tracks and empty groups are passed by.
Updates the sorting order of this block and all of its manually created siblings so that the given block has the lowest sorting order. If the block is parented to a track, it is first moved up in the hierarchy.
Update the block's always-on-bottom property. If true, this blocks's global sorting order is automatically adjusted to be lower than all other siblings without this property. If more than one block is set to be always-on-bottom, the child order decides which is on the bottom. A page slice fails with BLOCK.TYPE_CANNOT_BE_ARRANGED, because its place in the page is its reading order.
Update the block's always-on-top property. If true, this blocks's global sorting order is automatically adjusted to be higher than all other siblings without this property. If more than one block is set to be always-on-top, the child order decides which is on top. A page slice fails with BLOCK.TYPE_CANNOT_BE_ARRANGED, because its place in the page is its reading order.
Set an audio fade-in for the given block. The audio ramps up from silence to the block's volume over the given duration at the start of the block.
Set an audio fade-out for the given block. The audio ramps down from the block's volume to silence over the given duration at the end of the block.
Set the background color of the given design block. Required scope: "fill/change"
Enable or disable the background of the given design block. Required scope: "fill/change"
Set the blend mode of the given design block. Required scope: "layer/blendMode"
Enable or disable the blur of the given design block.
Set a boolean property of the given design block to the given value.
Update a block's clipped state. A clipped page slice cuts the blocks that it owns at its folds and at the page edges with their bleed. A click beside the page still selects them. Required scope: "layer/clipping"
Set a color property of the given design block to the given value.
Sets a published property on an instance as text. This is an override.
Set the horizontal alignment of the content fill inside the block.
Set a block's content fill mode. Required scope: "layer/crop"
Set the vertical alignment of the content fill inside the block.
Set whether the crop aspect ratio should be locked for the given block. When enabled, the block will have a FixedAspectRatioTag and crop handles will maintain aspect ratio. When disabled, the FixedAspectRatioTag will be removed and free resizing is allowed. Required scope: "layer/crop"
Set the crop rotation of the given design block. Required scope: "layer/crop"
Set the crop scale ratio of the given design block. This will uniformly scale the content up or down. The center of the scale operation is the center of the crop frame. On a page with a bleed, the ratio and the center of the scale include the bleed. This needs the setting page/imageFillCoversBleed, which is on by default. Required scope: "layer/crop"
Set the crop scale in x direction of the given design block. Required scope: "layer/crop"
Set the crop scale in y direction of the given design block. Required scope: "layer/crop"
Set the crop translation in x direction of the given design block. Required scope: "layer/crop"
Set the crop translation in y direction of the given design block. Required scope: "layer/crop"
Set a double property of the given design block to the given value.
Set the drop shadow's blur radius on the x axis of the given design block. Required scope: "appearance/shadow"
Set the drop shadow's blur radius on the y axis of the given design block. Required scope: "appearance/shadow"
Set the drop shadow's clipping of the given design block. (Only applies to shapes.) Required scope: "appearance/shadow"
Set the drop shadow color of the given design block. Required scope: "appearance/shadow"
Enable or disable the drop shadow of the given design block. Required scope: "appearance/shadow"
Set the drop shadow's x offset of the given design block. Required scope: "appearance/shadow"
Set the drop shadow's y offset of the given design block. Required scope: "appearance/shadow"
Set the playback duration of the given block in seconds. The duration defines for how long the block is active in the scene during playback. If a duration is set on the page block, it becomes the duration source block. Note: The duration is ignored when the scene is not in "Video" mode. Note: This also adjusts the trim for non looping blocks. Note: A clip on a track without automatic offsets keeps its transitions. The next clip of each transition moves, with the clips that transitions join after it, until the overlap equals the transition duration again. The overlap is at most half of either clip. With transition/overlap disabled, or with a group clip on either side, the clips meet at the cut.
Sets the enabled state of an effect block.
Set the block that an effect block reads, such as the map of a displacement map effect. The source still draws on its own. It is read without its position and rotation, and also when it is hidden. Required scope: "appearance/effect" on every block the effect is attached to.
Set an enum property of the given design block to the given value. Setting scene/mode to Video fails with BLOCK.PAGE_SLICE_IN_VIDEO_SCENE when the scene holds a page slice.
Sets the block containing the fill properties of the given block. On a page slice, the call also enables the fill, because a new page slice has its fill disabled. Note: The previous fill block is not destroyed automatically. Required scopes: "fill/change", "fill/changeType"
Enable or disable the fill of the given design block. Required scope: "fill/change"
Mark the fill of the given design block as overprint for PDF export.
Set the fill color of the given design block. Required scope: "fill/change"
Update a block's horizontal flip. With the setting features/implicitUpdatesEnabled off, the call updates only when a block that it reads has no layout yet, as right after an undo. It reads the block, the members of a group and each transform parent. That update also lays out every other pending change. The block is mirrored around the center of its frame, so its rendered bounds do not move. For a block without rotation, anchor or skew, turning the flip on moves getPositionX and getFrameX to the visual right edge (x + width). Turning it off moves them back. getGlobalBoundingBoxX stays the same. Required scope: "layer/flip"
Update a block's vertical flip. With the setting features/implicitUpdatesEnabled off, the call updates only when a block that it reads has no layout yet, as right after an undo. It reads the block, the members of a group and each transform parent. That update also lays out every other pending change. The block is mirrored around the center of its frame, so its rendered bounds do not move. For a block without rotation, anchor or skew, turning the flip on moves getPositionY and getFrameY to the visual bottom edge (y + height). Turning it off moves them back. getGlobalBoundingBoxY stays the same. Required scope: "layer/flip"
Set a float property of the given design block to the given value.
Sets the given font and typeface for the text block. Existing formatting is reset. Required scope: "text/character"
Stores a runtime font request for this block or text range and starts resolution. The request is preserved through load/save even when unavailable. Existing URI font APIs retain their behavior. Resolution is asynchronous. Await forceLoadResources before measuring or exporting. Substitution can change layout; metric-compatible substitution is not provided. Required scope: "text/character".
Set a gradient color stops property of the given design block.
Update a block's height and optionally maintain the crop. A new height of a page with page slices goes to every page slice on a horizontal axis. On a vertical axis, it goes to the last page slice. A page slice that this shrinks stops at 25 pixels at the DPI of the scene. So the page can end up higher than asked. A height of 0 or less on a page slice fails with BLOCK.PAGE_SLICE_SIZE_INVALID. If the crop is maintained, the crop values will be automatically adjusted. The content fill mode Cover is only kept if the features/transformEditsRetainCoverMode setting is enabled, otherwise it will change to Crop. If the size of a group is changed, both dimensions are modified and the aspect ratio of the group is kept. Required scope: "layer/resize"
Set a block's mode for its height. A switch between Absolute and Percent keeps the stored height and reads it in the new mode. Set the height after the mode, without maintainCrop: otherwise the crop is adjusted from the size that the old number has in the new mode. Required scope: "layer/resize"
Sets the "in" animation for the given block.
Set if you want the given design block to be included in exported result.
Switches an instance to the variant with this property value. Overrides stay, and layers match by name.
Set an int property of the given design block to the given value.
Replace the keyframe track of a block property. Keyframe times are normalized over the duration of the block, from 0 to 1. The engine sorts the keyframes by time. Setting the static value of the property does not change its keyframes. The keyframes belong to the block that owns the property. Replacing a fill, shape or effect does not move them to the new block. Scaling the block or changing the design unit also converts the keyframes of length and position properties, such as corner radii and position. Rotating or flipping the block turns or mirrors the keyframes of its position, rotation and skew with it. A group's keyframes turn with the group. A turn other than a half turn joins position/x and position/y tracks into one position track. They must share the mode, the times and the easings, and no position track may exist. Other axis tracks cannot turn: their Absolute values move with the block, and their Relative values stay. A rotation track turns a graphic or text without an anchor around its frame center, as setRotation does. With transform/anchor/x or transform/anchor/y set, even to 0, it turns around the anchor. The vec2 properties position (a block) and shape/position (a shape) animate the /x and /y properties together. Their spatialOut and spatialIn tangents curve the motion path. getVec2 and setVec2 read and write their static value. A position/x or position/y track overrides that axis of a position track. Position keyframes are in design units, also when the position mode is PositionMode.PERCENT. Required scope: "appearance/animation" and the scope that the setter of the property needs, such as "layer/move" for position or "layer/rotate" for rotation. A transform/scale/x or transform/scale/y keyframe that shows a scale with another sign than the static scale also needs "layer/flip".
Set the kind of the given block, fails if the block is invalid.
Sets the "loop" animation for the given block.
Set whether the block should start from the beginning again or stop.
Mask a block with the rendered alpha or luminance of another block, like a track matte. A block used as a matte source is not drawn on its own. If the source draws nothing, for example because it is hidden or outside its time range, an alpha or luma matte hides the block and an inverted matte shows it whole. SVG export does not apply mattes, so a matted block exports whole. Required scope: "layer/clipping" on the block, and "layer/visibility" on the source, which stops drawing on its own.
Set a metadata value of a block identified by a key. If the key does not exist, yet, it will be added.
Set whether the audio of the block is muted.
Update a block's name.
Update the pixels of the given pixelStreamFill block. This method should be called in order to bind a new android.graphics.SurfaceTexture to the pixelStreamFill, as well as after every android.graphics.SurfaceTexture.updateTexImage invocation. Note that the native texture is created only once: all subsequent calls on the same pixel stream fill will return the same id.
Set the opacity of the given design block. Required scope: "layer/opacity"
Sets the "out" animation for the given block.
Set a block as duration source so that the overall page duration is automatically determined by this. If no defining block is set, the page duration is calculated over all children. Only one block per page can be marked as duration source. Will automatically unmark the previously marked.
Enable or disable the placeholder behavior for a block.
Enable or disable the visibility of the placeholder button for a block.
Enable or disable the visibility of the placeholder overlay pattern for a block.
Enable or disable the placeholder function for a block.
Sets the playback speed multiplier of a block that supports playback control. Note: This also adjusts the trim and duration of the block. Video fills running faster than 3.0x are force muted until reduced to 3.0x or below. An audio block that createAudioFromVideo extracts from a video faster than 3.0x keeps that speed and is force muted too. This function still rejects a speed above 3.0x for it. On a group, the speed changes no duration and acts only when group/composition is true: the children then run that many times faster. A clip whose duration this changes keeps its transitions, as with setDuration.
Set the playback time of the given block.
Set whether the block should be during active playback. Note that playing a page switches the editor to the Playback edit mode. From 0.2 s after the start, a change to the position, size, rotation, fill or text of a content block ends that mode. So does a change to the opacity, adjustments, shape or volume of any block, the page included. The editor returns to the Transform edit mode, which stops the playback. While a page plays, only a change on that page counts. A change to a block on another page, or to a block that is not in the scene, keeps the playback running.
Update a block's x position. The position refers to the block's local space, relative to its parent with the origin at the top left. A page slice takes its position from its page, so the call fails with BLOCK.POSITION_PARENT_CONTROLLED on one. Required scope: "layer/move"
Set a block's mode for its x position. The position refers to the block's local space, relative to its parent with the origin at the top left. Required scope: "layer/move"
Update a block's y position. The position refers to the block's local space, relative to its parent with the origin at the top left. A page slice takes its position from its page, so the call fails with BLOCK.POSITION_PARENT_CONTROLLED on one. Required scope: "layer/move"
Set a block's mode for its y position. The position refers to the block's local space, relative to its parent with the origin at the top left. Required scope: "layer/move"
Update a block's rotation. With the setting features/implicitUpdatesEnabled off, the call updates only when a block that it reads has no layout yet, as right after an undo. It reads the block, the members of a group and each transform parent. That update also lays out every other pending change. Required scope: "layer/rotate"
Enable or disable a scope for a given block.
Update the selection state of a block. Fails for invalid blocks. Note: Previously selected blocks remain selected. A page slice and its page are never selected together: selecting one deselects the other. Required scope: "editor/select"
Sets the block containing the shape properties of the given block. Note: The previous shape block is not destroyed automatically. A page with page slices takes only a rect shape. Required scope: "shape/change"
Set whether the given block or fill should play its contents while the rest of the scene remains paused. Note: Setting this to true for one block will automatically set it to false on all other blocks.
Set the source set of a source set property of the given block. The crop and content fill mode of the associated block will be set to the default values.
Set the spot color assign to a cutout type. If no spot color is set, type CutoutType.SOLID is assigned "CutContour" and type CutoutType.DASHED is assigned "PerfCutContour". All cutout blocks of the given type will be immediately assigned that spot color.
Set the state of a block. While an image fill is pending, the engine adds no automatic source set entries to it.
Set a string property of the given design block to the given value.
Set the stroke color of the given design block. Required scope: "stroke/change"
Set the stroke corner geometry of the given design block. Required scope: "stroke/change"
Set a custom dash pattern for the given design block's stroke. Semantics match SVG's stroke-dasharray: alternating on/off lengths in design-unit space. When the pattern is non-empty it overrides the preset implied by StrokeStyle. Pass an empty list to fall back to the preset. Required scope: "stroke/change"
Set the cap geometry at the trailing edge of each dash piece (excluding the line's actual end). Only takes effect when a dash pattern is active. Distinct from setStrokeEndCap, which only applies to the end of the open path itself.
Set the dash offset of the given design block's stroke. Semantics match SVG's stroke-dashoffset. Ignored when the custom dash pattern is empty. Required scope: "stroke/change"
Set the cap geometry at the leading edge of each dash piece (excluding the line's actual start). Only takes effect when a dash pattern is active. Distinct from setStrokeStartCap, which only applies to the start of the open path itself.
Enable or disable the stroke of the given design block. Required scope: "stroke/change"
Set the cap geometry at the end of an open stroked path.
Paints the stroke of the given block with a fill block, for example a gradient, instead of the stroke color. Color, gradient, stripe and image fills are supported; video and pixel stream fills are rejected. An image covers the frame of the block and the part of the stroke outside it. The crop, the effects and the blur of the block apply only to its fill. Note: The previous stroke fill block is not destroyed automatically. The fill block may not be the block's own fill. A stroke color with alpha 0 still hides the stroke; the fill's own colors set the opacity otherwise. Required scope: "stroke/change"
Mark the stroke of the given design block as overprint for PDF export.
Set the stroke position of the given design block. Required scope: "stroke/change"
Set the cap geometry at the start of an open stroked path. Pair with both-ends shortcut.
Set the stroke style of the given design block. Required scope: "stroke/change"
Set the stroke width of the given design block. When the dash pattern is a preset's pattern at the old width, it is scaled to the new width. Any other dash pattern keeps its lengths. Required scope: "stroke/change"
Changes the background color of the text in the selected range to the given color. The background is drawn as a rectangle behind each affected text run, or as a band along the curve for text on a path. A fully transparent color removes the background from the range. The run background is independent of the block-level background color ("backgroundColor/color"); it is drawn on top of the block-level background. Required scope: "fill/change"
Sets the baseline shift for a grapheme range. Moves the glyphs of the range up from the baseline, or down for a negative value. The line height does not change. Required scope: "text/character"
Sets the given text case for the selected range of text. Required scope: "text/character"
Changes the color of the text in the selected range to the given color. Required scope: "fill/change"
Sets the text cursor range (selection) within the text block that is currently being edited. If from equals to, the cursor is positioned at that index.
Sets the text decoration for the selected range of text. Required scope: "text/character"
Changes the size of the text in the selected range to the given size. If the font size is applied to the entire text block, its font size property will be updated. Required scope: "text/character"
Changes the style of the text in the selected range to the given style. Required scope: "text/character"
Changes the weight of the text in the selected range to the given weight. Required scope: "text/character"
Changes the weight and the style of the text in the selected range in one step. Each run gets the font of its typeface with exactly this weight and style. Separate calls to setTextFontWeight and setTextFontStyle pass through a face in between, so they fail when the typeface lacks that face. Required scope: "text/character"
Sets the paragraph-level horizontal alignment override for one or all paragraphs of a text block. Required scope: "text/character"
Sets kerning for a grapheme range.
Sets the line height multiplier for a specific paragraph or all paragraphs of a text block. Required scope: "text/character"
Sets the list nesting level for a specific paragraph or all paragraphs of a text block. Required scope: "text/character"
Sets the list style for a specific paragraph or all paragraphs of a text block. Required scope: "text/character"
Sets or clears the SVG path that defines a text block's baseline.
Sets whether text is placed on the opposite side of the baseline path.
Sets the start offset along the baseline path as a proportion of the path length.
Sets the OpenType features of a grapheme range, such as tnum for digits of equal width.
Sets the given script style for the selected range of text. Superscript and subscript text is scaled down and shifted off the regular baseline. The block properties "text/superscriptFontScale", "text/superscriptVerticalShift", "text/subscriptFontScale" and "text/subscriptVerticalShift" adjust the scale and shift. Required scope: "text/character"
Sets the variation axis values of a grapheme range, such as wdth for the width of a variable font.
Set the time offset of the given block relative to its parent. The time offset controls when the block is first active in the timeline. Note: The time offset is not supported by the page block.
Update a block's transform locked state.
Makes a block follow the transform of another block, or stops it from following one. The block's position, rotation and scale are then read in the local space of the transform parent, so the block moves with it. The block does not keep its place on screen when the link changes. Only the transform is inherited: opacity, visibility and the stacking order still come from the block's own parent. A hidden block can be a transform parent. When the transform parent is destroyed, the block stops following it. A block whose transform is locked can neither get nor lose a link. Required scope: "layer/move"
Assigns the outgoing transition of a clip.
Set the trim length of the given block or fill. The trim length is the duration of the audio or video clip that should be used for playback. Note: After reaching this value during playback, the trim region will loop. Note: This requires the video or audio clip to be loaded. Note: A clip whose duration this changes keeps its transitions, as with setDuration.
Set the trim offset of the given block or fill. Sets the time in seconds within the fill at which playback of the audio or video clip should begin. Note: This requires the video or audio clip to be loaded.
Sets the given typeface for the text block. The current formatting, e.g., bold or italic, is retained as far as possible. Some formatting might change if the new typeface does not support it, e.g. thin might change to light, bold to normal, and/or italic to non-italic. If the typeface is applied to the entire text block, its typeface property will be updated. If a run does not support the new typeface, it will fall back to the default typeface from the typeface property. Required scope: "text/character"
Set a uri property of the given design block to the given value.
Bind a block property to a color, number, image or typeface variable, and apply the variable's current value. Color variables bind to color properties and number variables to float properties. Image variables bind only to "fill/image/imageFileURI", "fill/image/previewFileURI" and "fill/video/fileURI". Typeface variables bind only to "text/typeface" and "caption/typeface". A direct write to a bound property fails with BLOCK.PROPERTY_BOUND until the binding is removed. A bound typeface also locks setTypeface and setFont. On a text block, a variable bound to "fill/solid/color" or the font size sets every run of the text, and setTextColor or setTextFontSize fails for any range. Keyframes, undo and scene loads still change it. Changing the design unit converts a bound length. A number variable whose bound properties all hold its value converts with them. Otherwise the variable keeps its value, and the next variable write sets the lengths in the new unit.
Sets the value of a variant property on a main component.
Set a vec2 property of the given design block to the given value. position sets position/x and position/y, and shape/position sets shape/position/x and shape/position/y, with the checks of those properties. Either both components change or neither does.
Update a block's visibility. A hidden page slice hides the blocks that it owns, as a hidden parent hides its children. They show in no canvas and no export, and take no hit. It keeps its room in the page. The blocks keep their own visibility. Required scope: "layer/visibility"
Set the audio volume of the given block.
Update a block's width and optionally maintain the crop. A new width of a page with page slices goes to its last page slice on a horizontal axis. On a vertical axis, it goes to every page slice. A page slice that this shrinks stops at 25 pixels at the DPI of the scene. So the page can end up wider than asked. A width of 0 or less on a page slice fails with BLOCK.PAGE_SLICE_SIZE_INVALID. If the crop is maintained, the crop values will be automatically adjusted. The content fill mode Cover is only kept if the features/transformEditsRetainCoverMode setting is enabled, otherwise it will change to Crop. If the size of a group is changed, both dimensions are modified and the aspect ratio of the group is kept. Required scope: "layer/resize"
Set a block's mode for its width. A switch between Absolute and Percent keeps the stored width and reads it in the new mode. Set the width after the mode, without maintainCrop: otherwise the crop is adjusted from the size that the old number has in the new mode. Required scope: "layer/resize"
Split a block at the specified time. The original block will be trimmed to end at the split time, and the returned duplicate will start at the split time and continue to the original end time.
Returns whether the block supports animation.
Query if the given block has background color properties.
Query if the given block has a blend mode.
Checks whether the block supports blur.
Query if the given block has a content fill mode.
Query if the given block has crop properties.
Query if the given block has a drop shadow property.
Returns whether the block has a duration property.
Queries whether the block supports effects.
Query if the given block has fill color properties.
Checks whether the block supports masks. Graphic, text and group blocks do.
Queries whether the block supports modifiers. Every shape block does.
Query if the given block has an opacity.
Returns whether the block can be marked as the element that defines the duration of the given page.
Query whether the block supports placeholder behavior.
Checks whether the block supports placeholder controls.
Returns whether the block supports a playback control.
Returns whether the block has a playback time property.
Query if the given block has a shape property.
Query if the given block has a stroke property.
Queries whether the block supports text animators. Text and caption blocks do.
Returns whether the block has a time offset property.
Checks whether a clip can own an outgoing clip-to-clip transition.
Returns whether the block has trim properties.
Toggles the font weight of the given block between bold and normal. Required scope: "text/character"
Toggles the font style of the given block between italic and normal. Required scope: "text/character"
Toggles the text decoration overline of the given block. Required scope: "text/character"
Toggles the text decoration strikethrough of the given block. Required scope: "text/character"
Toggles the text decoration underline of the given block. Required scope: "text/character"
Ungroups a group.